linger in (someone's) mind

Translations
засесть в (чьей-то) голове
The haunting melody lingered in her mind for days.
Завораживающая мелодия засела в её голове на несколько дней.
Definitions
To remain in someone's thoughts or memory for an extended period, often evoking feelings or reflections related to a particular experience or person.